Fix large string handling in CLUSTER|NODES and CLUSTER|SHARDS#1858
Merged
kevin-montrose merged 6 commits intoJun 8, 2026
Conversation
…s; another example of the issue we should cleanup up re. #1781
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the “large response spins forever” pattern (previously addressed for INFO in #1776) for cluster responses, specifically CLUSTER NODES and CLUSTER SHARDS, by introducing a path that can emit outputs larger than the fixed send buffer without relying on while (!TryWriteX(...)) SendAndReset() loops that may never make progress.
Changes:
- Adds
RespWriteUtils.TryWriteBulkStringLength(int len, ...)to allow writing just the$<len>\r\nprefix without requiring the full payload to fit. - Switches
CLUSTER NODESandCLUSTER SHARDShandlers to use a new helper intended to stream large outputs. - Introduces
WriteAsciiLargeRespStringin the cluster session to chunk output (usingArrayPool<byte>+ ASCII encoding) when it does not fit in the current send buffer.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| libs/common/RespWriteUtils.cs | Adds an overload to write a bulk-string length header from an int length. |
| libs/cluster/Session/RespClusterBasicCommands.cs | Reworks CLUSTER NODES/SHARDS response writing to use a new “large output” helper. |
tiagonapoli
reviewed
Jun 5, 2026
tiagonapoli
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same issue experimentally identified in #1781 and fixed for INFO in #1776.